<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
<import type="css" file="css.form" />
<import type="css" file="css.global" />
<import type="js" file="js.common" />
<import type="js" file="js.jquery" />
</head>

<body>
<div class="search"><b>修改菜单</b></div>
<div id="form">
	<form action="__URL__/save"  method="post" name="form1" onsubmit="return CheckForm();">
		<table>
		 <tr>
			<td class="titlename">应用名：</td>
			<td>
				<input type="text" name="action" size="25"  value="{$data.action}">&nbsp;
			</td>
		 </tr>
		 <tr>
			<td class="titlename">菜单名称：</td>
			<td>
				<input type="text" name="menu_name" size="25" maxlength="100" value="{$data.menu_name}">&nbsp;
			</td>
		 </tr>
		 <tr>
			<td class="titlename">分组：</td>
			<td>
				<select name="leve" class="leve" style="width: 180px;">
					<option value="0" <if condition="$data['leve'] eq 0">selected</if> />---未分组---
				<volist name="data_menu" id="vo">
					<option value="{$vo.menu_id}" <if condition="$vo['menu_id'] eq $data['leve']">selected</if> />{$vo.menu_name}
				</volist>
				</select>
			</td>
		 </tr>
		 <tr>
			<td class="titlename">PID：</td>
			<td>
				<select name="pid" class="pid" style="width: 180px;">
					<option value="0" >---顶级---
				<!--<volist name="data_menu" id="vo">
					<option value="{$vo.menu_id}" <if condition="$data['pid'] eq $vo['menu_id']">selected</if> />{$vo.menu_name}
				</volist>
				--></select>
			</td>
		 </tr>
		 <tr>
			<td class="titlename">启用状态：</td>
			<td>
				<select name="status" style="width: 180px;">
					<option value="1" <if condition="$data['status'] eq 1">selected</if> />---启用---
					<option value="0" <if condition="$data['status'] eq 0">selected</if> />---禁用---
				</select>
			</td>
		 </tr>
		 <tr>
			<td class="titlename">连接启用：</td>
			<td>
				<select name="type" style="width: 180px;">
					<option value="1" <if condition="$data['type'] eq 1">selected</if> />---启用---
					<option value="0" <if condition="$data['type'] eq 0">selected</if> />---禁用---
				</select>
			</td>
		 </tr>
		 <tr>
			<td class="titlename">排序：</td>
			<td>
				<input type="text" name="sort" size="25" value="{$data.sort}">&nbsp;
			</td>
		 </tr>
		 <tr>
			<td class="titlename"></td>
			<td>
				<input type="hidden" name="menu_id" value="{$data.menu_id}" >
				<input type="submit" value="保存" class="submit">&nbsp;&nbsp;
				<input type="button" value="返回" class="button" onclick="back()">
			</td>
		  </tr>
		</table>
	</form>
</div>
</body>
<script Language="JavaScript">
$(document).ready(function(){
	var leve = $("select[name='leve'] option:selected").val();
	if(leve != '0'){
		getjson(leve);
	}
	
	$(".leve").change(function(){
		var val = $(this).val();
		$(".pid option").remove();
		$(".pid").append("<option value='0' >---顶级---");
		getjson(val);
	});
});
function getjson(val){
	var pid = {$data.pid};
	$.get("__APP__/Menu/select_pid?leve="+val,function(result){
		var data = eval("("+result+")");
		$.each(data,function(id,value){
			if(pid == value.menu_id){
				$(".pid").append("<option value='"+value.menu_id+"' selected >"+value.menu_name);
			}else{
				$(".pid").append("<option value='"+value.menu_id+"' >"+value.menu_name);
			}
		});
	});
}
function CheckForm(){
	if($("input[name='action']").val()==""){alert("应用名不能为空");return false;}
	if($("input[name='menu_name']").val()==""){alert("菜单名不能为空");return false;}
}
</script>
</html>